package io.persimmon.core.module.calculation.instance;

import io.persimmon.core.module.calculation.Calculation;

public class SumCalculation implements Calculation<Double, Number> {

    private double sum;

    @Override
    public void accept(Number data) {
        sum += data.doubleValue();
    }

    @Override
    public Double calculationResult() {
        return sum;
    }

    @Override
    public void clean() {
        sum = 0;
    }
}
